//
//  InfinitelyScrollingView.h
//  TRoad2
//
//  Created by ZhangYanhua on 14/11/13.
//  Copyright (c) 2014年 Mach. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "CenterPagingFlowCollectionLayout.h"

@protocol CenterInfinitelyScrollingViewDelegate <NSObject>

- (UICollectionViewCell *)collectionView:(UICollectionView *)cv
                  cellForItemAtIndexPath:(NSIndexPath *)indexPath
                                withItem:(id)item
                              withObject:(NSArray *)items;

- (UICollectionViewCell *)collectionView:(UICollectionView *)cv
                  cellForItemAtIndexPath:(NSIndexPath *)indexPath
                                withItem:(id)item;

- (void)collectionView:(UICollectionView *)cv displayItemAtIndex:(NSInteger)index;
@end

@interface CenterInfinitelyScrollingView : UIView <UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout>

@property (nonatomic, weak) id<CenterInfinitelyScrollingViewDelegate>delegate;

/**
 *  禁用自动滚动
 */
@property (nonatomic, assign) BOOL disableAutoScroll;

@property (nonatomic, strong) NSArray *itemArray;
@property (nonatomic, assign) NSInteger currentIndex;
@property (nonatomic, strong) NSArray *items;

@property (nonatomic, strong) UICollectionViewFlowLayout *collectionViewLayout;
@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, strong) NSTimer *scrollTimer;

@property (nonatomic, strong) NSArray *totalArray;
- (id)initWithFrame:(CGRect)aFrame ItemArray:(NSArray *)itemArray;

@end
